Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 /*
  2  * This plugin provides some filter controls (for GUI code debugging).
  3  * It does nothing else, video frames just passed through as-is.
  4  *
  5  * You can have a look at the invert filter for sample code which
  6  * actually does some image processing.
  7  *
  8  * (c) 2002 Gerd Knorr <kraxel@bytesex.org>
  9  *
 10  */
 11 
 12 #include "config.h"
 13 
 14 #include <stdio.h>
 15 #include <stdlib.h>
 16 #include <pthread.h>
 17 
 18 #include "grab-ng.h"
 19 
 20 /* ------------------------------------------------------------------- */
 21 
 22 static void *init(struct ng_video_fmt *out)
 23 {
 24     /* don't have to carry around status info */
 25     static int dummy;
 26     return &dummy;
 27 }
 28 
 29 static struct ng_video_buf*
 30 frame(void *handle, struct ng_video_buf *in)
 31 {
 32     /* do nothing -- just return the frame as-is */
 33     return in;
 34 }
 35 
 36 static void fini(void *handle)
 37 {
 38     /* nothing to clean up */
 39 }
 40 
 41 /* ------------------------------------------------------------------- */
 42 
 43 static int vals[3] = { 32, 1, 2 };
 44 
 45 static int read_attr(struct ng_attribute *attr)
 46 {
 47     return vals[attr->id];
 48 }
 49 
 50 static void write_attr(struct ng_attribute *attr, int value)
 51 {
 52     fprintf(stderr,PLUGNAME ": %s: %d\n", attr->name, value);
 53     vals[attr->id] = value;
 54 }
 55 
 56 /* ------------------------------------------------------------------- */
 57 
 58 static struct STRTAB items[] = {
 59     {  1, "entry 1" },
 60     {  2, "entry 2" },
 61     {  3, "entry 3" },
 62     { -1, NULL },
 63 };
 64 
 65 static struct ng_attribute attrs[] = {
 66     {
 67         id:       0,
 68         name:     "scale (integer)",
 69         type:     ATTR_TYPE_INTEGER,
 70         min:      0,
 71         max:      100,
 72         read:     read_attr,
 73         write:    write_attr,
 74     },{
 75         id:       1,
 76         name:     "yes/no (boolean)",
 77         type:     ATTR_TYPE_BOOL,
 78         read:     read_attr,
 79         write:    write_attr,
 80     },{
 81         id:       2,
 82         name:     "menu (choice)",
 83         type:     ATTR_TYPE_CHOICE,
 84         choices:  items,
 85         read:     read_attr,
 86         write:    write_attr,
 87     },{
 88         /* end of list */
 89     }
 90 };
 91 
 92 static struct ng_filter filter = {
 93     name:    "gui debug",
 94     attrs:   attrs,
 95     fmts:
 96     (1 << VIDEO_RGB08)    |
 97     (1 << VIDEO_GRAY)     |
 98     (1 << VIDEO_RGB15_LE) |
 99     (1 << VIDEO_RGB16_LE) |
100     (1 << VIDEO_RGB15_BE) |
101     (1 << VIDEO_RGB16_BE) |
102     (1 << VIDEO_BGR24)    |
103     (1 << VIDEO_BGR32)    |
104     (1 << VIDEO_RGB24)    |
105     (1 << VIDEO_RGB32)    |
106     (1 << VIDEO_YUV422)   |
107     (1 << VIDEO_YUV422P)  |
108     (1 << VIDEO_YUV420P),
109     init:    init,
110     frame:   frame,
111     fini:    fini,
112 };
113 
114 extern void ng_plugin_init(void);
115 void ng_plugin_init(void)
116 {
117     ng_filter_register(NG_PLUGIN_MAGIC,PLUGNAME,&filter);
118 }
119 
  This page was automatically generated by the LXR engine.