Mercurial > mplayer.hg
annotate libmpcodecs/vd_dmo.c @ 30086:f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
and sub "stream headers".
One reason for this is to help avoid/make more obvious things like members with
the same function but different name (extradata vs. codecdata etc.), or members
with the same name but different semantics (pts for audio vs. pts for video).
author | reimar |
---|---|
date | Sun, 27 Dec 2009 14:40:56 +0000 |
parents | 0f1b5b68af32 |
children | bbb6ebec87a0 |
rev | line source |
---|---|
8295 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <stdarg.h> | |
4 | |
5 #include "config.h" | |
6 | |
7 #include "mp_msg.h" | |
8 #include "help_mp.h" | |
9 | |
10 #include "vd_internal.h" | |
11 | |
12 #include "loader/dmo/DMO_VideoDecoder.h" | |
13 | |
14 static vd_info_t info = { | |
15 "DMO video codecs", | |
16 "dmo", | |
17 "A'rpi", | |
18 "based on http://avifile.sf.net", | |
19 "win32 codecs" | |
20 }; | |
21 | |
22 LIBVD_EXTERN(dmo) | |
23 | |
24 // to set/get/query special features/parameters | |
25 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
26 return CONTROL_UNKNOWN; | |
27 } | |
28 | |
29 // init driver | |
30 static int init(sh_video_t *sh){ | |
31 unsigned int out_fmt; | |
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); | |
12763
f34a7cf4265a
Console message corrected and moved to help_mp-en.h.
diego
parents:
8504
diff
changeset
|
34 mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_DownloadCodecPackage); |
8295 | 35 return 0; |
36 } | |
37 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; | |
38 out_fmt=sh->codec->outfmt[sh->outfmtidx]; | |
39 switch(out_fmt){ | |
40 case IMGFMT_YUY2: | |
41 case IMGFMT_UYVY: | |
42 DMO_VideoDecoder_SetDestFmt(sh->context,16,out_fmt);break; // packed YUV | |
43 case IMGFMT_YV12: | |
44 case IMGFMT_I420: | |
45 case IMGFMT_IYUV: | |
46 DMO_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV | |
47 case IMGFMT_YVU9: | |
48 DMO_VideoDecoder_SetDestFmt(sh->context,9,out_fmt);break; | |
49 default: | |
50 DMO_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR | |
51 } | |
52 DMO_VideoDecoder_StartInternal(sh->context); | |
12763
f34a7cf4265a
Console message corrected and moved to help_mp-en.h.
diego
parents:
8504
diff
changeset
|
53 mp_msg(MSGT_DECVIDEO,MSGL_V,MSGTR_DMOInitOK); |
8295 | 54 return 1; |
55 } | |
56 | |
57 // uninit driver | |
58 static void uninit(sh_video_t *sh){ | |
59 DMO_VideoDecoder_Destroy(sh->context); | |
60 } | |
61 | |
62 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); | |
63 | |
64 // decode a frame | |
65 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
66 mp_image_t* mpi; | |
67 if(len<=0) return NULL; // skipped frame | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
18765
diff
changeset
|
68 |
8295 | 69 if(flags&3){ |
70 // framedrop: | |
71 DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0); | |
72 return NULL; | |
73 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
18765
diff
changeset
|
74 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
18765
diff
changeset
|
75 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, |
8295 | 76 sh->disp_w, sh->disp_h); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
18765
diff
changeset
|
77 |
8295 | 78 if(!mpi){ // temporary! |
18004
bcd805923554
Part2 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu with LOTS of modifications by me
reynaldo
parents:
12763
diff
changeset
|
79 mp_msg(MSGT_DECVIDEO,MSGL_WARN,MSGTR_MPCODECS_CouldntAllocateImageForCinepakCodec); |
8295 | 80 return NULL; |
81 } | |
82 | |
83 DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 1, mpi->planes[0]); | |
84 | |
85 return mpi; | |
86 } |