annotate libmpcodecs/vf_rgbtest.c @ 34797:079b53acda6d

Workaround bug in mpg123. In rare cases, after seeking mplayer stops audio playback and would repeat "No stream opened. (code 24)" until next seek. This is caused by bug in mpg123_getformat() that triggers needless reading of next frame, possibly hitting bogus MPG123_NEED_MORE. The function is fixed in mpg123 1.14.0+. This commit however allows older mpg123 versions to work properly in mplayer. Patch by Thomas Orgis, thomas-forum orgis org
author iive
date Wed, 02 May 2012 21:15:07 +0000
parents 7af3e6f901fd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30421
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
1 /*
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
2 * This file is part of MPlayer.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
3 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
5 * it under the terms of the GNU General Public License as published by
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
7 * (at your option) any later version.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
8 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
12 * GNU General Public License for more details.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
13 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
14 * You should have received a copy of the GNU General Public License along
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
17 */
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
18
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
19 #include <stdio.h>
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
20 #include <stdlib.h>
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
21 #include <string.h>
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
22 #include <inttypes.h>
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
23
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 13145
diff changeset
24 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 13145
diff changeset
25 #include "mp_msg.h"
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
26
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
27 #include "img_format.h"
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
28 #include "mp_image.h"
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
29 #include "vf.h"
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
30
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
31 //===========================================================================//
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
32
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
33 struct vf_priv_s {
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
34 unsigned int fmt;
25988
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
35 int w, h;
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
36 };
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
37
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
38 static unsigned int getfmt(unsigned int outfmt){
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
39 switch(outfmt){
31082
92f88bb315c5 Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents: 30642
diff changeset
40 case IMGFMT_RGB12:
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
41 case IMGFMT_RGB15:
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
42 case IMGFMT_RGB16:
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
43 case IMGFMT_RGB24:
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
44 case IMGFMT_RGBA:
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
45 case IMGFMT_ARGB:
31082
92f88bb315c5 Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents: 30642
diff changeset
46 case IMGFMT_BGR12:
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
47 case IMGFMT_BGR15:
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
48 case IMGFMT_BGR16:
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
49 case IMGFMT_BGR24:
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
50 case IMGFMT_BGRA:
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
51 case IMGFMT_ABGR:
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31082
diff changeset
52 return outfmt;
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
53 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25988
diff changeset
54 return 0;
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
55 }
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
56
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
57 static void put_pixel(uint8_t *buf, int x, int y, int stride, int r, int g, int b, int fmt){
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
58 switch(fmt){
31082
92f88bb315c5 Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents: 30642
diff changeset
59 case IMGFMT_BGR12: ((uint16_t*)(buf + y*stride))[x]=
92f88bb315c5 Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents: 30642
diff changeset
60 ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4);
92f88bb315c5 Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents: 30642
diff changeset
61 break;
92f88bb315c5 Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents: 30642
diff changeset
62 case IMGFMT_RGB12: ((uint16_t*)(buf + y*stride))[x]=
92f88bb315c5 Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents: 30642
diff changeset
63 ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4);
92f88bb315c5 Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents: 30642
diff changeset
64 break;
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
65 case IMGFMT_BGR15: ((uint16_t*)(buf + y*stride))[x]= ((r>>3)<<10) | ((g>>3)<<5) | (b>>3);
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
66 break;
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
67 case IMGFMT_RGB15: ((uint16_t*)(buf + y*stride))[x]= ((b>>3)<<10) | ((g>>3)<<5) | (r>>3);
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
68 break;
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
69 case IMGFMT_BGR16: ((uint16_t*)(buf + y*stride))[x]= ((r>>3)<<11) | ((g>>2)<<5) | (b>>3);
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
70 break;
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
71 case IMGFMT_RGB16: ((uint16_t*)(buf + y*stride))[x]= ((b>>3)<<11) | ((g>>2)<<5) | (r>>3);
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
72 break;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25988
diff changeset
73 case IMGFMT_RGB24:
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
74 buf[3*x + y*stride + 0]= r;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
75 buf[3*x + y*stride + 1]= g;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
76 buf[3*x + y*stride + 2]= b;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
77 break;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
78 case IMGFMT_BGR24:
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
79 buf[3*x + y*stride + 0]= b;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
80 buf[3*x + y*stride + 1]= g;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
81 buf[3*x + y*stride + 2]= r;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
82 break;
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
83 case IMGFMT_RGBA:
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
84 buf[4*x + y*stride + 0]= r;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
85 buf[4*x + y*stride + 1]= g;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
86 buf[4*x + y*stride + 2]= b;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
87 break;
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
88 case IMGFMT_BGRA:
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
89 buf[4*x + y*stride + 0]= b;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
90 buf[4*x + y*stride + 1]= g;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
91 buf[4*x + y*stride + 2]= r;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
92 break;
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
93 case IMGFMT_ARGB:
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
94 buf[4*x + y*stride + 1]= r;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
95 buf[4*x + y*stride + 2]= g;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
96 buf[4*x + y*stride + 3]= b;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
97 break;
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
98 case IMGFMT_ABGR:
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
99 buf[4*x + y*stride + 1]= b;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
100 buf[4*x + y*stride + 2]= g;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
101 buf[4*x + y*stride + 3]= r;
13145
be7ed0dfe056 change to match current bgr/rgb definition
michael
parents: 11894
diff changeset
102 break;
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
103 }
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
104 }
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
105
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
106 static int config(struct vf_instance *vf,
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
107 int width, int height, int d_width, int d_height,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31082
diff changeset
108 unsigned int flags, unsigned int outfmt){
25988
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
109 if (vf->priv->w > 0) { d_width = width = vf->priv->w; }
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
110 if (vf->priv->h > 0) { d_height = height = vf->priv->h; }
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
111 vf->priv->fmt=getfmt(outfmt);
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
112 mp_msg(MSGT_VFILTER,MSGL_V,"rgb test format:%s\n", vo_format_name(outfmt));
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
113 return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
114 }
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
115
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
116 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
117 mp_image_t *dmpi;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
118 int x, y;
25988
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
119 int w = vf->priv->w > 0 ? vf->priv->w : mpi->w;
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
120 int h = vf->priv->h > 0 ? vf->priv->h : mpi->h;
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
121
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
122 // hope we'll get DR buffer:
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
123 dmpi=vf_get_image(vf->next,vf->priv->fmt,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31082
diff changeset
124 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31082
diff changeset
125 w, h);
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
126
25988
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
127 for(y=0; y<h; y++){
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
128 for(x=0; x<w; x++){
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
129 int c= 256*x/w;
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
130 int r=0,g=0,b=0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25988
diff changeset
131
25988
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
132 if(3*y<h) r=c;
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
133 else if(3*y<2*h) g=c;
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
134 else b=c;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25988
diff changeset
135
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
136 put_pixel(dmpi->planes[0], x, y, dmpi->stride[0], r, g, b, vf->priv->fmt);
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
137 }
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
138 }
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
139
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
140 return vf_next_put_image(vf,dmpi, pts);
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
141 }
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
142
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
143 //===========================================================================//
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
144
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
145 static int query_format(struct vf_instance *vf, unsigned int outfmt){
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
146 unsigned int fmt=getfmt(outfmt);
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
147 if(!fmt) return 0;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
148 return vf_next_query_format(vf,fmt) & (~VFCAP_CSP_SUPPORTED_BY_HW);
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
149 }
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
150
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30421
diff changeset
151 static int vf_open(vf_instance_t *vf, char *args){
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
152 vf->config=config;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
153 vf->put_image=put_image;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
154 vf->query_format=query_format;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
155 vf->priv=malloc(sizeof(struct vf_priv_s));
25988
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
156 vf->priv->w = vf->priv->h = 0;
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
157 if (args)
ef8d3d2d9d73 Allow specifying a size for -vf rgbtest
reimar
parents: 25221
diff changeset
158 sscanf(args, "%d:%d", &vf->priv->w, &vf->priv->h);
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
159 return 1;
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
160 }
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
161
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 23373
diff changeset
162 const vf_info_t vf_info_rgbtest = {
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
163 "rgbtest",
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
164 "rgbtest",
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
165 "Michael Niedermayer",
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
166 "",
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30421
diff changeset
167 vf_open,
11894
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
168 NULL
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
169 };
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
170
4c24bad2a86b rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
michael
parents:
diff changeset
171 //===========================================================================//