Mercurial > mplayer.hg
annotate libmpcodecs/vf_format.c @ 16099:629c54dc7e0d
support for rectangular and streaming textures.
author | reimar |
---|---|
date | Tue, 26 Jul 2005 10:16:18 +0000 |
parents | bc8cda64ad7f |
children | 6ff3379a0862 |
rev | line source |
---|---|
5539 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 #include <inttypes.h> | |
5 | |
6 #include "../config.h" | |
7 #include "../mp_msg.h" | |
8 | |
5607 | 9 #include "img_format.h" |
10 #include "mp_image.h" | |
5539 | 11 #include "vf.h" |
12 | |
9601 | 13 #include "m_option.h" |
14 #include "m_struct.h" | |
15 | |
16 static struct vf_priv_s { | |
5539 | 17 unsigned int fmt; |
9601 | 18 } vf_priv_dflt = { |
19 IMGFMT_YUY2 | |
5539 | 20 }; |
21 | |
22 //===========================================================================// | |
23 | |
24 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | |
25 if(fmt==vf->priv->fmt) | |
26 return vf_next_query_format(vf,fmt); | |
27 return 0; | |
28 } | |
29 | |
30 static int open(vf_instance_t *vf, char* args){ | |
31 vf->query_format=query_format; | |
6001 | 32 vf->default_caps=0; |
9601 | 33 if(!vf->priv) { |
34 vf->priv=malloc(sizeof(struct vf_priv_s)); | |
35 vf->priv->fmt=IMGFMT_YUY2; | |
36 } | |
5539 | 37 if(args){ |
6872 | 38 if(!strcasecmp(args,"444p")) vf->priv->fmt=IMGFMT_444P; else |
39 if(!strcasecmp(args,"422p")) vf->priv->fmt=IMGFMT_422P; else | |
40 if(!strcasecmp(args,"411p")) vf->priv->fmt=IMGFMT_411P; else | |
5539 | 41 if(!strcasecmp(args,"yuy2")) vf->priv->fmt=IMGFMT_YUY2; else |
42 if(!strcasecmp(args,"yv12")) vf->priv->fmt=IMGFMT_YV12; else | |
43 if(!strcasecmp(args,"i420")) vf->priv->fmt=IMGFMT_I420; else | |
6525 | 44 if(!strcasecmp(args,"yvu9")) vf->priv->fmt=IMGFMT_YVU9; else |
45 if(!strcasecmp(args,"if09")) vf->priv->fmt=IMGFMT_IF09; else | |
5539 | 46 if(!strcasecmp(args,"iyuv")) vf->priv->fmt=IMGFMT_IYUV; else |
47 if(!strcasecmp(args,"uyvy")) vf->priv->fmt=IMGFMT_UYVY; else | |
48 if(!strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else | |
49 if(!strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else | |
50 if(!strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else | |
5565
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5539
diff
changeset
|
51 if(!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else |
6525 | 52 if(!strcasecmp(args,"bgr8")) vf->priv->fmt=IMGFMT_BGR8; else |
6836 | 53 if(!strcasecmp(args,"bgr4")) vf->priv->fmt=IMGFMT_BGR4; else |
9171 | 54 if(!strcasecmp(args,"bg4b")) vf->priv->fmt=IMGFMT_BG4B; else |
6836 | 55 if(!strcasecmp(args,"bgr1")) vf->priv->fmt=IMGFMT_BGR1; else |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6525
diff
changeset
|
56 if(!strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6525
diff
changeset
|
57 if(!strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6525
diff
changeset
|
58 if(!strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6525
diff
changeset
|
59 if(!strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6525
diff
changeset
|
60 if(!strcasecmp(args,"rgb8")) vf->priv->fmt=IMGFMT_RGB8; else |
6836 | 61 if(!strcasecmp(args,"rgb4")) vf->priv->fmt=IMGFMT_RGB4; else |
9171 | 62 if(!strcasecmp(args,"rg4b")) vf->priv->fmt=IMGFMT_RG4B; else |
6836 | 63 if(!strcasecmp(args,"rgb1")) vf->priv->fmt=IMGFMT_RGB1; else |
12999 | 64 if(!strcasecmp(args,"rgba")) vf->priv->fmt=IMGFMT_RGBA; else |
65 if(!strcasecmp(args,"argb")) vf->priv->fmt=IMGFMT_ARGB; else | |
66 if(!strcasecmp(args,"bgra")) vf->priv->fmt=IMGFMT_BGRA; else | |
67 if(!strcasecmp(args,"abgr")) vf->priv->fmt=IMGFMT_ABGR; else | |
5539 | 68 { printf("Unknown format name: '%s'\n",args);return 0;} |
9601 | 69 } |
70 | |
5539 | 71 |
72 return 1; | |
73 } | |
74 | |
9601 | 75 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) |
76 static m_option_t vf_opts_fields[] = { | |
77 {"fmt", ST_OFF(fmt), CONF_TYPE_IMGFMT, 0,0 ,0, NULL}, | |
78 { NULL, NULL, 0, 0, 0, 0, NULL } | |
79 }; | |
80 | |
81 static m_struct_t vf_opts = { | |
82 "format", | |
83 sizeof(struct vf_priv_s), | |
84 &vf_priv_dflt, | |
85 vf_opts_fields | |
86 }; | |
87 | |
5539 | 88 vf_info_t vf_info_format = { |
89 "force output format", | |
90 "format", | |
91 "A'rpi", | |
5565
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5539
diff
changeset
|
92 "FIXME! get_image()/put_image()", |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9171
diff
changeset
|
93 open, |
9601 | 94 &vf_opts |
5539 | 95 }; |
96 | |
97 //===========================================================================// |