annotate libmpcodecs/vd_dmo.c @ 8388:45eb2d4d633c

The detection of a NetWM class window manager hints is tested before the test of a gnome class windomanager hints, since the gnome hints are outdated and replaced by the newer NetWM specification. Newer versions of Gnome support this standard, and therefore the test should be placed before the Gnome test. Windowmaker does not support NetWM and is checked after the NetWM test. In fact the new code should be placed also before the test for IceWM. Regarding other WMs such as KDE, IceWM the change is not tested. patch by Svante Signell <svante.signell@telia.com>
author arpi
date Sat, 07 Dec 2002 01:25:30 +0000
parents cd02bf201f38
children 321763255480
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8295
cd02bf201f38 DMO support
arpi
parents:
diff changeset
1 #include <stdio.h>
cd02bf201f38 DMO support
arpi
parents:
diff changeset
2 #include <stdlib.h>
cd02bf201f38 DMO support
arpi
parents:
diff changeset
3 #include <stdarg.h>
cd02bf201f38 DMO support
arpi
parents:
diff changeset
4
cd02bf201f38 DMO support
arpi
parents:
diff changeset
5 #include "config.h"
cd02bf201f38 DMO support
arpi
parents:
diff changeset
6 #ifdef USE_DIRECTSHOW
cd02bf201f38 DMO support
arpi
parents:
diff changeset
7
cd02bf201f38 DMO support
arpi
parents:
diff changeset
8 #include "mp_msg.h"
cd02bf201f38 DMO support
arpi
parents:
diff changeset
9 #include "help_mp.h"
cd02bf201f38 DMO support
arpi
parents:
diff changeset
10
cd02bf201f38 DMO support
arpi
parents:
diff changeset
11 #include "vd_internal.h"
cd02bf201f38 DMO support
arpi
parents:
diff changeset
12
cd02bf201f38 DMO support
arpi
parents:
diff changeset
13 #include "loader/dmo/DMO_VideoDecoder.h"
cd02bf201f38 DMO support
arpi
parents:
diff changeset
14
cd02bf201f38 DMO support
arpi
parents:
diff changeset
15 static vd_info_t info = {
cd02bf201f38 DMO support
arpi
parents:
diff changeset
16 "DMO video codecs",
cd02bf201f38 DMO support
arpi
parents:
diff changeset
17 "dmo",
cd02bf201f38 DMO support
arpi
parents:
diff changeset
18 "A'rpi",
cd02bf201f38 DMO support
arpi
parents:
diff changeset
19 "based on http://avifile.sf.net",
cd02bf201f38 DMO support
arpi
parents:
diff changeset
20 "win32 codecs"
cd02bf201f38 DMO support
arpi
parents:
diff changeset
21 };
cd02bf201f38 DMO support
arpi
parents:
diff changeset
22
cd02bf201f38 DMO support
arpi
parents:
diff changeset
23 LIBVD_EXTERN(dmo)
cd02bf201f38 DMO support
arpi
parents:
diff changeset
24
cd02bf201f38 DMO support
arpi
parents:
diff changeset
25 // to set/get/query special features/parameters
cd02bf201f38 DMO support
arpi
parents:
diff changeset
26 static int control(sh_video_t *sh,int cmd,void* arg,...){
cd02bf201f38 DMO support
arpi
parents:
diff changeset
27 return CONTROL_UNKNOWN;
cd02bf201f38 DMO support
arpi
parents:
diff changeset
28 }
cd02bf201f38 DMO support
arpi
parents:
diff changeset
29
cd02bf201f38 DMO support
arpi
parents:
diff changeset
30 // init driver
cd02bf201f38 DMO support
arpi
parents:
diff changeset
31 static int init(sh_video_t *sh){
cd02bf201f38 DMO support
arpi
parents:
diff changeset
32 unsigned int out_fmt;
cd02bf201f38 DMO support
arpi
parents:
diff changeset
33 if(!(sh->context=DMO_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
cd02bf201f38 DMO support
arpi
parents:
diff changeset
34 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll);
cd02bf201f38 DMO support
arpi
parents:
diff changeset
35 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n");
cd02bf201f38 DMO support
arpi
parents:
diff changeset
36 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip !\n");
cd02bf201f38 DMO support
arpi
parents:
diff changeset
37 return 0;
cd02bf201f38 DMO support
arpi
parents:
diff changeset
38 }
cd02bf201f38 DMO support
arpi
parents:
diff changeset
39 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0;
cd02bf201f38 DMO support
arpi
parents:
diff changeset
40 out_fmt=sh->codec->outfmt[sh->outfmtidx];
cd02bf201f38 DMO support
arpi
parents:
diff changeset
41 switch(out_fmt){
cd02bf201f38 DMO support
arpi
parents:
diff changeset
42 case IMGFMT_YUY2:
cd02bf201f38 DMO support
arpi
parents:
diff changeset
43 case IMGFMT_UYVY:
cd02bf201f38 DMO support
arpi
parents:
diff changeset
44 DMO_VideoDecoder_SetDestFmt(sh->context,16,out_fmt);break; // packed YUV
cd02bf201f38 DMO support
arpi
parents:
diff changeset
45 case IMGFMT_YV12:
cd02bf201f38 DMO support
arpi
parents:
diff changeset
46 case IMGFMT_I420:
cd02bf201f38 DMO support
arpi
parents:
diff changeset
47 case IMGFMT_IYUV:
cd02bf201f38 DMO support
arpi
parents:
diff changeset
48 DMO_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV
cd02bf201f38 DMO support
arpi
parents:
diff changeset
49 case IMGFMT_YVU9:
cd02bf201f38 DMO support
arpi
parents:
diff changeset
50 DMO_VideoDecoder_SetDestFmt(sh->context,9,out_fmt);break;
cd02bf201f38 DMO support
arpi
parents:
diff changeset
51 default:
cd02bf201f38 DMO support
arpi
parents:
diff changeset
52 DMO_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR
cd02bf201f38 DMO support
arpi
parents:
diff changeset
53 }
cd02bf201f38 DMO support
arpi
parents:
diff changeset
54 DMO_VideoDecoder_StartInternal(sh->context);
cd02bf201f38 DMO support
arpi
parents:
diff changeset
55 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DMOhow video codec init OK!\n");
cd02bf201f38 DMO support
arpi
parents:
diff changeset
56 return 1;
cd02bf201f38 DMO support
arpi
parents:
diff changeset
57 }
cd02bf201f38 DMO support
arpi
parents:
diff changeset
58
cd02bf201f38 DMO support
arpi
parents:
diff changeset
59 // uninit driver
cd02bf201f38 DMO support
arpi
parents:
diff changeset
60 static void uninit(sh_video_t *sh){
cd02bf201f38 DMO support
arpi
parents:
diff changeset
61 DMO_VideoDecoder_Destroy(sh->context);
cd02bf201f38 DMO support
arpi
parents:
diff changeset
62 }
cd02bf201f38 DMO support
arpi
parents:
diff changeset
63
cd02bf201f38 DMO support
arpi
parents:
diff changeset
64 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
cd02bf201f38 DMO support
arpi
parents:
diff changeset
65
cd02bf201f38 DMO support
arpi
parents:
diff changeset
66 // decode a frame
cd02bf201f38 DMO support
arpi
parents:
diff changeset
67 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
cd02bf201f38 DMO support
arpi
parents:
diff changeset
68 mp_image_t* mpi;
cd02bf201f38 DMO support
arpi
parents:
diff changeset
69 if(len<=0) return NULL; // skipped frame
cd02bf201f38 DMO support
arpi
parents:
diff changeset
70
cd02bf201f38 DMO support
arpi
parents:
diff changeset
71 if(flags&3){
cd02bf201f38 DMO support
arpi
parents:
diff changeset
72 // framedrop:
cd02bf201f38 DMO support
arpi
parents:
diff changeset
73 DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0);
cd02bf201f38 DMO support
arpi
parents:
diff changeset
74 return NULL;
cd02bf201f38 DMO support
arpi
parents:
diff changeset
75 }
cd02bf201f38 DMO support
arpi
parents:
diff changeset
76
cd02bf201f38 DMO support
arpi
parents:
diff changeset
77 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/,
cd02bf201f38 DMO support
arpi
parents:
diff changeset
78 sh->disp_w, sh->disp_h);
cd02bf201f38 DMO support
arpi
parents:
diff changeset
79
cd02bf201f38 DMO support
arpi
parents:
diff changeset
80 if(!mpi){ // temporary!
cd02bf201f38 DMO support
arpi
parents:
diff changeset
81 printf("couldn't allocate image for cinepak codec\n");
cd02bf201f38 DMO support
arpi
parents:
diff changeset
82 return NULL;
cd02bf201f38 DMO support
arpi
parents:
diff changeset
83 }
cd02bf201f38 DMO support
arpi
parents:
diff changeset
84
cd02bf201f38 DMO support
arpi
parents:
diff changeset
85 DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 1, mpi->planes[0]);
cd02bf201f38 DMO support
arpi
parents:
diff changeset
86
cd02bf201f38 DMO support
arpi
parents:
diff changeset
87 return mpi;
cd02bf201f38 DMO support
arpi
parents:
diff changeset
88 }
cd02bf201f38 DMO support
arpi
parents:
diff changeset
89
cd02bf201f38 DMO support
arpi
parents:
diff changeset
90 #endif