Mercurial > mplayer.hg
comparison libmpcodecs/vd.c @ 4968:236b06410b03
vfw, vfwex, odivx, divx4 added
author | arpi |
---|---|
date | Thu, 07 Mar 2002 00:44:58 +0000 |
parents | ca6f6b35baf4 |
children | db86fcf25ede |
comparison
equal
deleted
inserted
replaced
4967:f88dfc3de52c | 4968:236b06410b03 |
---|---|
24 extern vd_functions_t mpcodecs_vd_null; | 24 extern vd_functions_t mpcodecs_vd_null; |
25 extern vd_functions_t mpcodecs_vd_cinepak; | 25 extern vd_functions_t mpcodecs_vd_cinepak; |
26 extern vd_functions_t mpcodecs_vd_qtrpza; | 26 extern vd_functions_t mpcodecs_vd_qtrpza; |
27 extern vd_functions_t mpcodecs_vd_ffmpeg; | 27 extern vd_functions_t mpcodecs_vd_ffmpeg; |
28 extern vd_functions_t mpcodecs_vd_dshow; | 28 extern vd_functions_t mpcodecs_vd_dshow; |
29 extern vd_functions_t mpcodecs_vd_vfw; | |
30 extern vd_functions_t mpcodecs_vd_vfwex; | |
31 extern vd_functions_t mpcodecs_vd_odivx; | |
32 extern vd_functions_t mpcodecs_vd_divx4; | |
29 | 33 |
30 vd_functions_t* mpcodecs_vd_drivers[] = { | 34 vd_functions_t* mpcodecs_vd_drivers[] = { |
31 &mpcodecs_vd_null, | 35 &mpcodecs_vd_null, |
32 &mpcodecs_vd_cinepak, | 36 &mpcodecs_vd_cinepak, |
33 &mpcodecs_vd_qtrpza, | 37 &mpcodecs_vd_qtrpza, |
34 #ifdef USE_LIBAVCODEC | 38 #ifdef USE_LIBAVCODEC |
35 &mpcodecs_vd_ffmpeg, | 39 &mpcodecs_vd_ffmpeg, |
36 #endif | 40 #endif |
41 #ifdef USE_WIN32DLL | |
37 #ifdef USE_DIRECTSHOW | 42 #ifdef USE_DIRECTSHOW |
38 &mpcodecs_vd_dshow, | 43 &mpcodecs_vd_dshow, |
44 #endif | |
45 &mpcodecs_vd_vfw, | |
46 &mpcodecs_vd_vfwex, | |
47 #endif | |
48 #ifdef USE_DIVX | |
49 &mpcodecs_vd_odivx, | |
50 #ifdef NEW_DECORE | |
51 &mpcodecs_vd_divx4, | |
52 #endif | |
39 #endif | 53 #endif |
40 NULL | 54 NULL |
41 }; | 55 }; |
42 | 56 |
43 int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt){ | 57 int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt){ |
54 // mp_imgflag: buffer requirements (read/write, preserve, stride limits), see mp_image.h | 68 // mp_imgflag: buffer requirements (read/write, preserve, stride limits), see mp_image.h |
55 // returns NULL or allocated mp_image_t* | 69 // returns NULL or allocated mp_image_t* |
56 // Note: buffer allocation may be moved to mpcodecs_config_vo() later... | 70 // Note: buffer allocation may be moved to mpcodecs_config_vo() later... |
57 mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h){ | 71 mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h){ |
58 mp_image_t* mpi=NULL; | 72 mp_image_t* mpi=NULL; |
73 int w2=(mp_imgflag&MP_IMGFLAG_ACCEPT_STRIDE)?((w+15)&(~15)):w; | |
59 // Note: we should call libvo first to check if it supports direct rendering | 74 // Note: we should call libvo first to check if it supports direct rendering |
60 // and if not, then fallback to software buffers: | 75 // and if not, then fallback to software buffers: |
61 switch(mp_imgtype){ | 76 switch(mp_imgtype){ |
62 case MP_IMGTYPE_EXPORT: | 77 case MP_IMGTYPE_EXPORT: |
63 // mpi=new_mp_image(w,h); | 78 // mpi=new_mp_image(w,h); |
64 if(!export_images[0]) export_images[0]=new_mp_image(w,h); | 79 if(!export_images[0]) export_images[0]=new_mp_image(w2,h); |
65 mpi=export_images[0]; | 80 mpi=export_images[0]; |
66 break; | 81 break; |
67 case MP_IMGTYPE_STATIC: | 82 case MP_IMGTYPE_STATIC: |
68 if(!static_images[0]) static_images[0]=new_mp_image(w,h); | 83 if(!static_images[0]) static_images[0]=new_mp_image(w2,h); |
69 mpi=static_images[0]; | 84 mpi=static_images[0]; |
70 break; | 85 break; |
71 case MP_IMGTYPE_TEMP: | 86 case MP_IMGTYPE_TEMP: |
72 if(!temp_images[0]) temp_images[0]=new_mp_image(w,h); | 87 if(!temp_images[0]) temp_images[0]=new_mp_image(w2,h); |
73 mpi=temp_images[0]; | 88 mpi=temp_images[0]; |
74 break; | 89 break; |
75 case MP_IMGTYPE_IPB: | 90 case MP_IMGTYPE_IPB: |
76 if(!(mp_imgflag&MP_IMGFLAG_READABLE)){ // B frame: | 91 if(!(mp_imgflag&MP_IMGFLAG_READABLE)){ // B frame: |
77 if(!temp_images[0]) temp_images[0]=new_mp_image(w,h); | 92 if(!temp_images[0]) temp_images[0]=new_mp_image(w2,h); |
78 mpi=temp_images[0]; | 93 mpi=temp_images[0]; |
79 break; | 94 break; |
80 } | 95 } |
81 case MP_IMGTYPE_IP: | 96 case MP_IMGTYPE_IP: |
82 if(!static_images[static_idx]) static_images[static_idx]=new_mp_image(w,h); | 97 if(!static_images[static_idx]) static_images[static_idx]=new_mp_image(w2,h); |
83 mpi=static_images[static_idx]; | 98 mpi=static_images[static_idx]; |
84 static_idx^=1; | 99 static_idx^=1; |
85 break; | 100 break; |
86 } | 101 } |
87 if(mpi){ | 102 if(mpi){ |
88 mpi->type=mp_imgtype; | 103 mpi->type=mp_imgtype; |
89 mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE); | 104 mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE); |
90 mpi->flags|=mp_imgflag&(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE); | 105 mpi->flags|=mp_imgflag&(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE); |
91 if((mpi->width!=w || mpi->height!=h) && !(mpi->flags&MP_IMGFLAG_DIRECT)){ | 106 if((mpi->width!=w2 || mpi->height!=h) && !(mpi->flags&MP_IMGFLAG_DIRECT)){ |
92 mpi->width=w; | 107 mpi->width=w2; |
93 mpi->height=h; | 108 mpi->height=h; |
94 if(mpi->flags&MP_IMGFLAG_ALLOCATED){ | 109 if(mpi->flags&MP_IMGFLAG_ALLOCATED){ |
95 // need to re-allocate buffer memory: | 110 // need to re-allocate buffer memory: |
96 free(mpi->planes[0]); | 111 free(mpi->planes[0]); |
97 mpi->flags&=~MP_IMGFLAG_ALLOCATED; | 112 mpi->flags&=~MP_IMGFLAG_ALLOCATED; |